using Kassandra.Core;
using Kassandra.WindowsUI;

namespace Kassandra.WindowsUI
{
    public class CheckForExistingImageByAssignedCharacter : ICheckForExistingImageByAssignedCharacter
    {
        private readonly ICharacterToFileNameTranslator _characterToFileNameTranslator;
        private readonly IImageFileFinder _imageFileFinder;

        public CheckForExistingImageByAssignedCharacter():this(new CharacterToFileNameTranslator(), new ImageFileFinder())
        {
        }

        public CheckForExistingImageByAssignedCharacter(ICharacterToFileNameTranslator characterToFileNameTranslator, IImageFileFinder imageFileFinder)
        {
            _characterToFileNameTranslator = characterToFileNameTranslator;
            _imageFileFinder = imageFileFinder;
        }

        public bool AgainstTheCharacter(char characterToCheckFor)
        {
            string fileNameToCheck = _characterToFileNameTranslator.Using(characterToCheckFor);
            return _imageFileFinder.FileExistsWithNameOf(fileNameToCheck) != null;
        }
    }
}